import { fileURLToPath, URL } from 'node:url'
import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    lazyImport({
      resolvers: [
        VxeResolver({
          libraryName: 'vxe-table',
          resolveStyle: true,
        }),
        VxeResolver({
          libraryName: 'vxe-pc-ui',
          resolveStyle: true,
        })
      ]
    }),
  ],
  build: {
    rollupOptions: {
      external: ['opencv.js']  // 排除该文件
    }
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
})
